import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
      //求 N 的阶乘
        Scanner scanner = new Scanner(System.in);
        System.out.print("输入一个正整数：");//5!+4!+3!+2!+1!==120+24+6+2+1==1535
        int n = scanner.nextInt();
        System.out.println(sum(n));
    }
    public static int fact(int x){
        if(x == 1) return 1;
        return x * fact(x - 1);
    }
    public static int sum(int n){
        int sum = 0;
        for(int i = 1; i <= n; i++) sum += fact(i);
        return sum;
    }
}